﻿<UserControl x:Class="YoderZone.Extensions.Options.LoggingOptions"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:nLog="clr-namespace:YoderZone.Extensions.NLog;assembly=NLogConfig"
             xmlns:options="clr-namespace:YoderZone.Extensions.Options"
             d:DataContext="{d:DesignData ILoggingOptionsModel}"
             d:DesignHeight="492.375"
             d:DesignWidth="515"
             mc:Ignorable="d">
    <DockPanel LastChildFill="False"
               SnapsToDevicePixels="True">
        <TextBlock DockPanel.Dock="Top"
                   FontFamily="Times New Roman"
                   FontSize="24pt"
                   FontWeight="Bold"
                   Text="Remarker Diagnostics" />
        <TextBlock DockPanel.Dock="Top"
                   TextWrapping="Wrap">
            You can enable (or disable) and configure
            diagnostic logging on this page. The levels you select determine the
            amount of logging to collect. Trace usually includes details about
            parameters and variables, and generally produces the most volume.
            Debug generally contains program flow information, and can also
            produce a large amount of information. As you go down the levels
            the amount of logging produced by each is less than those above.
            Generally you should select consecutive levels starting at the bottom
            of the column.
        </TextBlock>
        <GroupBox Margin="0,4,0,0"
                  DockPanel.Dock="Top">
            <GroupBox.Header>
                <Label FontWeight="Bold">Logging Options</Label>
            </GroupBox.Header>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="3*" />
                    <ColumnDefinition Width="2*" />
                </Grid.ColumnDefinitions>
                <Grid Grid.Column="0"
                      VerticalAlignment="Top">
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <TextBlock Margin="4"
                               TextWrapping="Wrap">
                        To disable Remarker logging clear the check box below.
                        Check it to enable logging.
                    </TextBlock>
                    <CheckBox x:Name="onOff"
                              Grid.Row="1"
                              Margin="4"
                              Content="Remarker Logging"
                              IsChecked="{Binding IsLoggingEnabled}" />
                    <TextBlock Grid.Row="2"
                               Margin="4"
                               TextWrapping="Wrap">
                        This check box controls internal logging for the logging
                        system itself.
                    </TextBlock>
                    <CheckBox Grid.Row="3"
                              Margin="4"
                              Content="Internal Logging Diagnostics"
                              IsChecked="{Binding IsNLogConfigLoggingEnabled}" />
                </Grid>
                <Grid Grid.Column="1"
                      Margin="4,0"
                      HorizontalAlignment="Left">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>

                    <TextBlock Margin="4"
                               Text="Trace" />
                    <CheckBox Grid.Row="0"
                              Grid.Column="1"
                              Margin="4"
                              VerticalAlignment="Center"
                              IsChecked="{Binding IsTraceEnabled}" />
                    <TextBlock Grid.Row="1"
                               Grid.Column="0"
                               Margin="4"
                               Text="Debug" />
                    <CheckBox Grid.Row="1"
                              Grid.Column="1"
                              Margin="4"
                              VerticalAlignment="Center"
                              IsChecked="{Binding IsDebugEnabled}" />
                    <TextBlock Grid.Row="2"
                               Grid.Column="0"
                               Margin="4"
                               Text="Info" />
                    <CheckBox Grid.Row="2"
                              Grid.Column="1"
                              Margin="4"
                              VerticalAlignment="Center"
                              IsChecked="{Binding IsInfoEnabled}" />
                    <TextBlock Grid.Row="3"
                               Grid.Column="0"
                               Margin="4"
                               Text="Warn" />
                    <CheckBox Grid.Row="3"
                              Grid.Column="1"
                              Margin="4"
                              VerticalAlignment="Center"
                              IsChecked="{Binding IsWarnEnabled}" />
                    <TextBlock Grid.Row="4"
                               Grid.Column="0"
                               Margin="4"
                               Text="Error" />
                    <CheckBox Grid.Row="4"
                              Grid.Column="1"
                              Margin="4"
                              VerticalAlignment="Center"
                              IsChecked="{Binding IsErrorEnabled}" />
                    <TextBlock Grid.Row="5"
                               Grid.Column="0"
                               Margin="4"
                               Text="Fatal" />

                    <CheckBox Grid.Row="5"
                              Grid.Column="1"
                              Margin="4"
                              VerticalAlignment="Center"
                              IsChecked="{Binding IsFatalEnabled}" />
                </Grid>
            </Grid>
        </GroupBox>
        <GroupBox DockPanel.Dock="Top">
            <GroupBox.Header>
                <Label FontWeight="Bold">Log Folders</Label>
            </GroupBox.Header>
            <DockPanel LastChildFill="False">
                <Button Margin="4"
                        HorizontalContentAlignment="Left"
                        Click="OpenFolderButtonClicked"
                        DockPanel.Dock="Top"
                        IsEnabled="{Binding LogFilesPathExists}"
                        Padding="10,2"
                        Tag="{Binding LogFilesPath}">
                    <TextBlock HorizontalAlignment="Left"
                               Text="{Binding LogFilesPath}"
                               TextTrimming="CharacterEllipsis" />
                </Button>
                <Button Margin="4"
                        HorizontalContentAlignment="Left"
                        Click="OpenFolderButtonClicked"
                        DockPanel.Dock="Top"
                        IsEnabled="{Binding NLogConfigLogFilePathExists}"
                        Padding="10,2"
                        Tag="{Binding NLogConfigLogFilePath}">
                    <TextBlock HorizontalAlignment="Left"
                               Text="{Binding NLogConfigLogFilePath}"
                               TextTrimming="CharacterEllipsis" />
                </Button>
            </DockPanel>
        </GroupBox>
        <TextBlock HorizontalAlignment="Center"
                   DockPanel.Dock="Top"
                   Text="{Binding Version,
                                  RelativeSource={RelativeSource FindAncestor,
                                                                 AncestorType=options:LoggingOptions}}" />
    </DockPanel>
</UserControl>
